home *** CD-ROM | disk | FTP | other *** search
- AIFF decoder: a tool for retrieving data from Amstrad CPC tapes
- ---------------------------------------------------------------
- (c) Pierre Guerrier, 1996 - e-mail: guerrier@ecoledoc.ibp.fr
-
-
- Legal Stuff:
- -----------
- This software is provided "as is" and with no warranty of any kind.
- You can redistribute if freely as long as it is unmodified.
- I remain the copyright owner. You can bundle or build the code into
- software of your own (like an emulator) provided I am credited for it.
-
-
- What is it ?
- -----------
- AIFF decoder takes an Audio Interchange Format file (AIFF, hence the name),
- preferably containing a digitized Amstrad CPC tape, and tries to process
- the sound signal to turn it back into your original data. Since AIFF is a
- very common format, you should be able to sample (or convert) tapes in AIFF
- on any machine (PC, Mac, Amiga, Unix box...) that has audio input capability.
-
- If you need good conversion utilities, check:
- Macintosh: SoundApp, by Norman Franke, franke1@llnl.gov
- any UNIX: SOX, by Lance Norskog, thinman@netcom.com
-
-
- The source code given below should compile under any Unix or DOS without any
- change. The tapes can be recorded in SpeedWrite 1 (2400 bps, default) or 0
- (1200 bps), but also with the Discology speed 3600 bps, and there is
- provision for speeds of 4800 and 9600 bps (not supported by the firmware
- routines, but available with some CPC utilities).
- You can switch the speed with an option flag (there is no auto-guess).
-
- Copy protections are not supported, only regular bit streams with 64 bytes
- headers, 2048 bytes blocks and the usual sync patterns will be recognized.
-
-
- How does it work ?
- ------------------
- First you need to compile it for your OS. Under Unix, type:
-
- > gcc decoder.c -o AIFFdec
-
- ... where decoder.c is the name of the C source file. For DOS boxes,
- you need to use a C compiler with full ANSI support (including libraries)
- and you must change a line at the beginning of decoder.c:
-
- #define MSDOS 0 -------->>> #define MSDOS 1
-
- This will ensure that file names are correctly adapted for DOS.
-
-
- Once you've got a binary, it's shell syntax is very simple:
-
- > AIFFdec [-rpvn] file
-
- where:
- r is an optional flag to use the second channel in stereo files (for those
- with a weird cable between the CPC and the target computer :-)
- p is an optional flag to change the polarity of the signal (again, it's
- to make up for miswired cables)
- v is the optional "verbose" function, so that internal steps of the decoding
- are detailed on the console.
- n is an optional numeric flag to set the signal speed, according to the
- table below. Note that the sampling frequency of your machine must be
- high enough for the required speed: see the table.
- "file" is the AIFF file to process.
-
- When a CPC file is correctly decoded, it is saved in a regular file on your
- system. This output file has a standard AMSDOS header (or no header for ASCII)
- and can be used immediately as a "tape file" with many emulators.
- AIFF decoder will notify progress, such as detection of leader,header,blocks,
- and new files it creates.
-
- Should anything go wrong, AIFF decoder will put up a warning, such as:
-
- File [name] is not valid uncompressed AIFF !
- Your source file is not in the correct format. Remember that you must not
- compress the audio data.
- Unable to process with optimal Nyquist frequency.
- The sample rate of your source file is insufficient. AIFF decoder will try
- to process it, but there may be errors.
- One rescued block !
- A block without header has been found. It is appended to a "Rescued.Blocks"
- file on your system.
- File [name] did not terminate properly !
- The last blocks of the file xx have not been found (actually, the one with
- the termination mark has not be found).
- Missed some blocks of file [name] !
- The block numbers made a "leap": the result file has a "hole" in it.
- In these cases, and if there has been rescued blocks, you can try "surgery"
- to clean the mess...
- Incorrect [DATA/HEADER] checksum: read [CRC read] for [CRC computed] !
- A difference was found between the CRC on the tape and the one computed
- from the extracted bit stream. There are faulty bits in the resulting file.
- For text data, this will cause a few weird characters. For binaries, it is
- rather lethal. There is nothing you can do except re-sampling the tape from
- scratch with a better signal quality.
-
-
-
- Speed Conversion table:
- ----------------------
-
- option flag baud rate preferred sampling rate
-
- 8 1200 (SW0) 5.5kHz
- 4 (default) 2400 (SW1) 11 kHz
- 3 3600 16 kHz
- 2 4800 22 kHz
- 1 9600 44 kHz
-